﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Drawing;

namespace com.lover.astd.common.partner
{
    public class LoginResult
    {
        private string _errMessage;
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMessage
        {
            get { return _errMessage; }
            set { _errMessage = value; }
        }
        private LoginStatusCode _statusCode;
        /// <summary>
        /// 错误代码
        /// </summary>
        public LoginStatusCode StatusCode
        {
            get { return _statusCode; }
            set { _statusCode = value; }
        }
        public string StatusDesc
        {
            get 
            {
                string result_tip = "";
                switch (_statusCode)
                {
                    case LoginStatusCode.FailInGetToken:
                        result_tip = "获取登录token失败, 请重试";
                        break;
                    case LoginStatusCode.NeedVerifyCode:
                        result_tip = _errMessage;
                        break;
                    case LoginStatusCode.FailInLogin:
                        result_tip = "登录失败, 请检查是否用户名/密码/验证码错误, 如确认无误, 请联系作者";
                        break;
                    case LoginStatusCode.FailInGetServerList:
                        result_tip = "获取服务器列表失败";
                        break;
                    case LoginStatusCode.FailInFindingGameUrl:
                        result_tip = "获取游戏地址失败";
                        break;
                    case LoginStatusCode.FailInGotoGameUrl:
                        result_tip = "跳转到游戏地址失败, 请查看是否已经合区";
                        break;
                    case LoginStatusCode.FailInGetSession:
                        result_tip = "获取会话失败";
                        break;
                    case LoginStatusCode.Success:
                        break;
                }
                return result_tip;
            }
        }
        private List<Cookie> _webCookies;
        /// <summary>
        /// 页面cookie
        /// </summary>
        public List<Cookie> WebCookies
        {
            get { return _webCookies; }
            set { _webCookies = value; }
        }
        private string _jSessionID = "";
        /// <summary>
        /// 获取游戏所需要的jsessionid
        /// </summary>
        public string JSessionID
        {
            get { return _jSessionID; }
            set { _jSessionID = value; }
        }
        private string _gameUrl = "";
        /// <summary>
        /// 游戏URL
        /// </summary>
        public string GameUrl
        {
            get { return _gameUrl; }
            set
            {
                if (value != null)
                {
                    _gameUrl = value;
                }
            }
        }
        private string _captchaUrl;
        /// <summary>
        /// 验证码图片地址
        /// </summary>
        public string CaptchaUrl
        {
            get { return _captchaUrl; }
            set { _captchaUrl = value; }
        }
        private Image _captchaImage;
        /// <summary>
        /// 验证码图片
        /// </summary>
        public Image CaptchaImage
        {
            get { return _captchaImage; }
            set { _captchaImage = value; }
        }
        private string _captchaExtra;
        /// <summary>
        /// 验证码额外字符串
        /// </summary>
        public string CaptchaExtra
        {
            get { return _captchaExtra; }
            set { _captchaExtra = value; }
        }
    }
}
